#include <iostream>
#include <vector>
#include <set>
using namespace std;

int main(int argc, char **argv){

    

    return 0;
}

vector<vector<int> > combine(int n, int k) {
    // Start typing your C/C++ solution below
    // DO NOT write int main() function
    set<set<int> > *pCombinesRead = new set<set<int> >;
    set<set<int> > *pCombinesWrite = new set<set<int> >;
    
    // for 1
    for(int i=1; i<=n; ++i){
        set<int> tmp;
        tmp.insert(i);
        pCombinesRead->insert(tmp);
    }
    // more
    for(int i=1; i<k; ++i){
        for(set<set<int> >::iterator it = pCombinesRead->begin();
            it != pCombinesRead->end();
            ++it){
            // try to add n
            for(int j=1; j<=n; ++j){
                if((*it).find(j) == (*it).end()){
                    set<int> tmp = *it;
                    tmp.insert(j);
                    pCombinesWrite->insert(tmp);
                }
            }
        }
        set<set<int> > *pTmp = pCombinesWrite;
        pCombinesWrite = pCombinesRead;
        pCombinesRead = pTmp;
        pCombinesWrite->clear();
    }
    // output
    vector<vector<int> > res;
    for(set<set<int> >::iterator it = pCombinesRead->begin();
        it != pCombinesRead->end();
        ++it){
        vector<int> tmp(it->begin(), it->end());   
        res.push_back(tmp);
    }
    delete pCombinesWrite;
    delete pCombinesRead;

    return res;
}